/*Joseph A. Coll
Cleaning ACS data for Political Disenfranchisement?
6/6/2025*/

*Load
use "ACS Data.dta", clear

fre race
gen perc_black = .
replace perc_black = 1 if race == 2
replace perc_black = 0 if race != 2
fre perc_black

collapse perc_black [pw=perwt], by(statefip year)
replace perc_black = perc_black  *100
label var perc_black "%Black State Pop."

rename statefip state_fips
fre state_fips
statastates, fips(state_fips)
replace state_name = proper(state_name)
drop _merge
fre state_abbrev

bro 

clonevar acs_year = year
replace year = year +1 

save "Percent Black by State.dta", replace 